**************************************************
************ Table 1: Frequency of State *********
************ Legislative Candidacy in Majority ***
************ Minority Districts ******************
**************************************************

do "do_files/prep_GRACE_data/load_prep_GRACE_data.do"


* NOTE: Using individual level data
quietly estpost tabstat (basket_latw) if ballot_mmd==1 & (basket_latw == 1) & mod(v05,2) == 0 , by(v05)  stat(count) listwise columns(variables) nototal
mat latw_counts = e(basket_latw)

quietly estpost tabstat (basket_latm) if ballot_mmd==1 & (basket_latm == 1) & mod(v05,2) == 0 , by(v05)  stat(count) listwise columns(variables) nototal
mat latm_counts = e(basket_latm)
 
mat combined_counts = latw_counts \ latm_counts \ (latm_counts - latw_counts)
mat rownames combined_counts = "Latinas" "Latinos" "Difference"

esttab matrix(combined_counts)

* pausing for users who might be looping through all replication files
pause

